package com.tis.database.entitys.promis;

import java.io.Serializable;

import javax.persistence.*;

import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * The primary key class for the CUSTOMER_ADDRESSES database table.
 * 
 */
@Embeddable
public class CustomerAddressPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	
	
	@Override
	public String toString()
	{
		return ToStringBuilder.reflectionToString(this);
	}

	@Column(name="CUSTOMER_CODE")
	private String customerCode;

	@Column(name="ADDRESS_CODE")
	private long addressCode;

	public CustomerAddressPK() {
	}
	public String getCustomerCode() {
		return this.customerCode;
	}
	public void setCustomerCode(String customerCode) {
		this.customerCode = customerCode;
	}
	public long getAddressCode() {
		return this.addressCode;
	}
	public void setAddressCode(long addressCode) {
		this.addressCode = addressCode;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof CustomerAddressPK)) {
			return false;
		}
		CustomerAddressPK castOther = (CustomerAddressPK)other;
		return 
			this.customerCode.equals(castOther.customerCode)
			&& (this.addressCode == castOther.addressCode);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.customerCode.hashCode();
		hash = hash * prime + ((int) (this.addressCode ^ (this.addressCode >>> 32)));
		
		return hash;
	}
}